// 拼接HTTPUrl
function url(type, pathname) {
  return window.RPConfig[type] + pathname
}

const dataApi = {
  //分页查询所有数据
  getDataPage: params => {
    return $http.post(url('itShare', '/lc/data/multiFormPage'), params)
  },
  //复制表单
  dataCopy: params => {
    return $http.post(url('itShare', '/lc/data/copy'), params)
  },
  //修改数据
  dataUpdate: params => {
    return $http.post(url('itShare', '/lc/data/update'), params)
  },
  //新增数据
  dataInsert: params => {
    return $http.post(url('itShare', '/lc/data/insert'), params)
  },
  //新增并提交炎黄流程
  dataSubmit: params => {
    return $http.post(url('itShare', '/lc/data/submit'), params)
  },
  //删除数据
  dataDelete: params => {
    return $http.post(url('itShare', '/lc/data/delete'), params)
  },
  //发起填报
  dataPulish: params => {
    return $http.post(url('itShare', '/lc/data/publish'), params)
  },
  //暂存数据
  dataSaveOrUpdate: params => {
    return $http.post(url('itShare', '/lc/data/saveOrUpdate'), params)
  },
  //通过主键查询单条数据
  dataGetById: params => {
    return $http.post(url('itShare', '/lc/data/getById'), params).then(res => res.data)
  },
  //修改单个字段
  fieldUpdate: params => {
    return $http.post(url('itShare', '/lc/data/field/update'), params)
  },
  //分页查询所有数据（评分类表单流程配置评分对象）
  scorePage: params => {
    return $http.post(url('itShare', '/lc/raw/data/score/page'), params)
  },
  //分页查询所有数据(汇总)
  summaryPage: params => {
    return $http.post(url('itShare', '/lc/parent/summaryPage'), params)
  },
  parentPage: params => {
    return $http.post(url('itShare', '/lc/parent/multiFormPage'), params)
  },
  //是否晋级(评分父单据)
  scoreIsPassed: params => {
    return $http.post(url('itShare', '/lc/score/isPassed'), params)
  },
  // 撤回单据
  dataWithdraw: params => {
    return $http.post(url('itShare', '/lc/data/undo'), params)
  },
  // 汇总
  getSummaryList: params => {
    return $http.post(url('itShare', '/lc/raw/data/findList'), params).then(res => res.data)
  },
  // 获取被评分对象菜单子类型列表
  getMenuChildTypeList: params => {
    return $http.post(url('itShare', '/lc/score/getBindSubTypeList'), params).then(res => res.data)
  }
}

export default dataApi
